package main

import (
	"fmt"
	"github.com/spf13/cobra"
	"os"
)

var rootCmd = &cobra.Command{
	Use: "vm-password-cli",
}

var password string

var changeCmd = &cobra.Command{
	Use:   "change",
	Short: "Change something",
	Run: func(cmd *cobra.Command, args []string) {
		if password == "" {
			fmt.Println("Password flag is required")
			return
		}
	},
}

var validateCmd = &cobra.Command{
	Use:   "validate",
	Short: "Validate something",
	Run: func(cmd *cobra.Command, args []string) {
		if password == "" {
			fmt.Println("Password flag is required")
			return
		}
	},
}

func main() {
	rootCmd.PersistentFlags().StringVarP(&password, "password", "p", "", "The password to use (required)")
	rootCmd.AddCommand(changeCmd, validateCmd)
	if err := rootCmd.Execute(); err != nil {
		fmt.Println(err)
		os.Exit(1)
	}
}
